﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace GA.Server.ApiInfo
{
    [Serializable]
    public class ApiZone
    {
        public int ActiveDuration { get; private set; }
        public int ActiveStartTime { get; private set; }
        public int HexZoneId { get; private set; }
        public string ZoneDescription { get; private set; }
        public string ZoneName { get; private set; }
        public string ZoneType { get; private set; }

        public ApiZone()
        {
        }

        public ApiZone(XmlReader reader)
        {
            while (!reader.EOF)
            {
                reader.Read();
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                        case "a:active_duration": ActiveDuration = int.Parse(ApiXmlNode.GetValue(reader)); break;
                        case "a:active_start_time": ActiveStartTime = int.Parse(ApiXmlNode.GetValue(reader)); break;
                        case "a:hex_zone_id": HexZoneId = int.Parse(ApiXmlNode.GetValue(reader)); break;
                        case "a:zone_description": ZoneDescription = ApiXmlNode.GetValue(reader); break;
                        case "a:zone_na": ZoneName = ApiXmlNode.GetValue(reader); break;
                        case "a:zone_type": ZoneType = ApiXmlNode.GetValue(reader); break;
                    }
                }
            }
        }

    }
}
